package com.tongji.housediy.utils
{
	import com.tongji.housediy.view.titlewindows.DoorRotationTitleWindow;
	import com.tongji.housediy.view.titlewindows.EntryTitleWindow;
	import com.tongji.housediy.view.titlewindows.FloorColorTitleWindow;
	import com.tongji.housediy.view.titlewindows.GoodsInfoTitleWindow;
	import com.tongji.housediy.view.titlewindows.GoodsTitleWindow;
	import com.tongji.housediy.view.titlewindows.LoginTitleWindow;
	import com.tongji.housediy.view.titlewindows.MyCollectionInformationTitleWindow;
	import com.tongji.housediy.view.titlewindows.NotLoginTitleWindow;
	import com.tongji.housediy.view.titlewindows.OpenDesignTitleWindow;
	import com.tongji.housediy.view.titlewindows.RegisterTitleWindow;
	import com.tongji.housediy.view.titlewindows.RoomColorWindowTitle;
	import com.tongji.housediy.view.titlewindows.RoomInfoTitleWindow;
	import com.tongji.housediy.view.titlewindows.SampleRoomTitleWindow;
	import com.tongji.housediy.view.titlewindows.SaveDesignTitleWindow;
	import com.tongji.housediy.view.titlewindows.SaveDesignVerifyTitleWindow;
	import com.tongji.housediy.view.titlewindows.WallColorWindowTitle;
	
	import flash.display.DisplayObject;
	
	import mx.core.IFlexDisplayObject;
	import mx.managers.PopUpManager;
	
	import org.robotlegs.core.IMediatorMap;

	/**
	 * 
	 * @author chenchao
	 * 
	 */
	public class PopUpAdmin
	{
		public static function popupCenterWindow(type:String, view:DisplayObject, mediatorMap:IMediatorMap, model:Boolean = true, name:String = null):void
		{
			var window:IFlexDisplayObject;
			
			switch (type)
			{
				case "roomInfo":
					window = new RoomInfoTitleWindow();
					break;
				case "furnitureInfo":
					window = new GoodsInfoTitleWindow();
					break;
				case "doorRotation":
					window = new DoorRotationTitleWindow();
					break;
				case "floorColor":
					window = new FloorColorTitleWindow();
					break;
				case "wallColor":
					window = new WallColorWindowTitle();
					break;
				case "roomColor":
					window = new RoomColorWindowTitle();
					break;
				case "userRegister":
					window = new RegisterTitleWindow(); //注册弹出框
					break;
				case "userLogin":
					window = new LoginTitleWindow();    //登录弹出框
					break;
				case "saveVerify":
					window = new SaveDesignVerifyTitleWindow();  //是否保存弹出框
					break;
				case "notLogin":
					window = new NotLoginTitleWindow();     //未登录弹出框
					break;
				case "entryTitle":
					window = new EntryTitleWindow();         //应用入口弹出框
					if(name != null)
					{
						window.name = name;
					}
					break;
				case "saveDesignTitle":
					window = new SaveDesignTitleWindow();    //保存设计弹出框
					break;
				case "openDesignTitle":
					window = new OpenDesignTitleWindow();
					break;
				case "sampleHouseTitle":
					window = new SampleRoomTitleWindow();
					break;
			}
			
			PopUpManager.addPopUp(window, view, model);
			window.x = (int)(view.stage.stageWidth / 2 - window.width / 2);
			window.y = (int)(view.stage.stageHeight / 2 - window.height / 2);
			mediatorMap.createMediator(window);
		}
	}
}